package com.dosen.api.third.party.cmp.config;


import com.dosen.api.common.util.network.HttpUtils;
import com.dosen.api.common.util.network.MeResponse;
import com.dosen.api.third.party.cmp.client.CmpClient;
import com.dosen.api.third.party.cmp.client.impl.CmpClientImpl;
import com.dosen.api.third.party.register.apiplatform.impl.CmpApi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @version V1.0
 * @author: guangcheng
 * @date: 2023/1/12 12:19
 * @description:
 */
@Configuration
@ConditionalOnBean({CmpApi.class})
public class CmpApiPluginAutoConfiguration {

    @Autowired
    HttpUtils httpUtils;
    @Autowired
    CmpApiProperties cmpApiProperties;
    @Autowired
    MeResponse response;


    @Bean
    public CmpClient cmpClient() {
        return new CmpClientImpl(response, httpUtils, cmpApiProperties);
    }
}

